package com.roy.DubboRPCDemo.executor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.roy.DubboRPCDemo.anno.ServiceExe;
import com.roy.DubboRPCDemo.bean.RPCResBean;
import com.roy.DubboRPCDemo.bean.UserBean;


public class UserExecutor {

private Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@ServiceExe(exeId = "initUser")
	public RPCResBean initUserInfo(String userId,String userName) {
		logger.info("initUser");
		UserBean user = new UserBean();
		user.setUserId(Integer.parseInt(userId));
		user.setUserName(userName);
		user.setUserPassword("init password");
		user.setUserInfo("init from server");
		
		RPCResBean res = new RPCResBean();
		res.setOptCode(0);
		res.setOptInfo("initUser from server");
		return res;
	}
	
	@ServiceExe(exeId = "destroyUser")
	public RPCResBean destroyUser(String userId) {
		logger.info("destroyUser");
		UserBean user = new UserBean();
		user.setUserId(Integer.parseInt(userId));
		
		RPCResBean res = new RPCResBean();
		res.setOptCode(0);
		res.setOptInfo("destoryUser from server");
		return res;
	}
}
